const {addrFormatError} = require('../constant/err.type')

const Validator = (rules)=>{
    return async(ctx,next)=>{
        try {
            
            ctx.verifyParams(rules);
             
        } catch (error) {
            console.log(error);
            addrFormatError.result = error
            return ctx.app.emit('error',addrFormatError,ctx)
            
        }
        await next()
    }

}
module.exports = {
    Validator,
}